package com.example.uicustomviews.google;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class LoginActivity extends AppCompatActivity {
    private EditText username_edi;
    private EditText password_edi;
    private String username;
    private String password;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        username_edi = findViewById(R.id.username_text);
        password_edi = findViewById(R.id.password_text);
        TextView textViewLogin = findViewById(R.id.login_1);
        textViewLogin.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                username = username_edi.getText().toString();
                password = password_edi.getText().toString();
                if(!username.trim().equals("")&&!password.trim().equals("")){
                      Intent intent = new Intent(LoginActivity.this,HomePageActivity.class);
                      startActivity(intent);
                  }
                else{
                    Toast.makeText(LoginActivity.this,"您的输入有误，请重新输入!",
                            Toast.LENGTH_SHORT).show();
                }
            }
        });
    }
}
